namespace QMVnSoft.SystemForms
{
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Drawing;

    public class FormDmCtLister : FormListLister
    {
        private IContainer components;

        public FormDmCtLister()
        {
            this.InitializeComponent();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            base.SuspendLayout();
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.ClientSize = new Size(0x2bd, 0x10a);
            base.LocalFieldCount = 0;
            base.LocalFieldName = "MA_CT";
            base.LocalTableName = "DMCT";
            base.Name = "FormDmCtLister";
            base.OrderFieldNames = "MA_CT";
            base.ShowAddButton = false;
            base.ShowDeleteButton = false;
            base.ShowFreeFields = false;
            base.ShowMergeButton = false;
            this.Text = "Danh mục chứng từ";
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        public override bool OnAdd()
        {
            return base.OnAdd();
        }

        public override bool OnEdit()
        {
            switch (Convert.ToInt16(base.LocalCurrentRow["Loai_Ct"].ToString()))
            {
                case 1:
                    base.LocalFormEditor = new FormDmCtEditor1();
                    break;

                case 2:
                    base.LocalFormEditor = new FormDmCtEditor2();
                    break;

                case 3:
                    base.LocalFormEditor = new FormDmCtEditor3();
                    break;

                case 4:
                    base.LocalFormEditor = new FormDmCtEditor4();
                    break;

                case 5:
                    base.LocalFormEditor = new FormDmCtEditor5();
                    break;

                case 6:
                    base.LocalFormEditor = new FormDmCtEditor6();
                    break;

                case 7:
                    base.LocalFormEditor = new FormDmCtEditor7();
                    break;

                case 8:
                    base.LocalFormEditor = new FormDmCtEditor8();
                    break;

                case 9:
                    base.LocalFormEditor = new FormDmCtEditor9();
                    break;
            }
            return base.OnEdit();
        }

        public override void OnFillData()
        {
            object[][] objArray = new object[5][];
            object[] objArray2 = new object[4];
            objArray2[0] = "Ma_Ct";
            objArray2[1] = "Mã";
            objArray2[2] = "C";
            objArray[0] = objArray2;
            object[] objArray3 = new object[4];
            objArray3[0] = "Ten_Ct";
            objArray3[1] = "Tên chứng từ";
            objArray3[2] = "C";
            objArray[1] = objArray3;
            object[] objArray4 = new object[4];
            objArray4[0] = "Ten_Ct_E";
            objArray4[1] = "Tên tiếng Anh";
            objArray4[2] = "C";
            objArray[2] = objArray4;
            object[] objArray5 = new object[4];
            objArray5[0] = "Title";
            objArray5[1] = "Ti\x00eau đề";
            objArray5[2] = "C";
            objArray[3] = objArray5;
            object[] objArray6 = new object[4];
            objArray6[0] = "Title_E";
            objArray6[1] = "Ti\x00eau đề tiếng Anh";
            objArray6[2] = "C";
            objArray[4] = objArray6;
            base.ColNames = objArray;
            base.OnFillData();
        }

        public override void OnRefresh()
        {
            base.LocalDataSet = new DmCtDataAccess().GetDataSet();
            base.OnRefresh();
        }
    }
}

